<h3>Agencies</h3>

<table>
  <tr>
    <th>Name</th>
    <th>Phone</th>
  </tr>

<% for agency in @agencies %>
  <tr>
    <td><%=agency.name%></td>
    <td><%=agency.phone%></td>
    <td><%=dt agency.updated_at %></td>

    <td><%= link_to 'Show', agency %></td>
    <% if current_user.can_edit_agency_by_id(agency.id) %>
      <td><%= link_to 'Sites', agency_sites_path(agency.id) %></td>
    <% end %>
    <% if is_admin? -%>
      <td><%= link_to 'Edit', edit_agency_path(agency) %></td>
      <td><%= link_to 'Delete', agency, :confirm => 'Are you sure?', :method => :delete, :class => 'delete' %></td>
    <% end -%>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'Add a new Agency', new_agency_path if is_admin? %>
